//
//  MyTableView.m
//  yun
//
//  Created by lanou3g on 15/12/16.
//  Copyright © 2015年 gljj. All rights reserved.
//

#import "MyTableView.h"
#import "MySubscriptionCell.h"



@interface MyTableView ()<UITableViewDataSource,UITableViewDelegate>


@end

@implementation MyTableView


-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.myTableView registerNib:[UINib nibWithNibName:@"MySubscriptionCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    
    self.mySegmentedController.selectedSegmentIndex = 0;
    [self.mySegmentedController addTarget:self action:@selector(segmentAction:) forControlEvents:(UIControlEventValueChanged)];
    
    self.myTableView.rowHeight = 80;
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
}


//分段控件点击选择
-(void)segmentAction:(UISegmentedControl *)segment
{
    NSInteger index = self.mySegmentedController.selectedSegmentIndex;
    switch (index) {
        case 0:
            [self selectMyTVReBo];
            break;
        case 1:
            [self selectMyTVTuiJian];
            break;
        case 2:
            [self selectMyTVZuiXin];
        default:
            break;
    }
}

//热播
-(void)selectMyTVReBo
{
    
    NSLog(@"热播");
}
//推荐
-(void)selectMyTVTuiJian
{
    NSLog(@"推荐");
    
}
//最新
-(void)selectMyTVZuiXin
{
    NSLog(@"最新");
}



-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    MySubscriptionCell *cell = [self.myTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"MySubscriptionCell" owner:self options:nil]lastObject];
    }
    
    return cell;
}







- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
